// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
// 引入echarts
import echarts from 'echarts'
//import API from './service/getData'
//
//Vue.prototype.API　=　API 
Vue.prototype.$echarts = echarts 
Vue.prototype.goBack = function() {
	if(window.ReturnFromH5) {   //安卓监听返回事件
		return window.ReturnFromH5.ComeBack();
	}
	else if(window.webkit){  //ios监听返回事件
		window.webkit.messageHandlers.historyBack.postMessage({body:"test"});
	} 
	else {  //浏览器监听返回事件
		history.back();	
	}
}
Vue.config.productionTip = false
Event = new Vue();
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  template: '<App/>',
  components: { App }
})

Object.assign = require('object.assign')

Date.prototype.Format = function(fmt) { //author: meizz 
	var o = {
		"M+": this.getMonth() + 1, //月份 
		"d+": this.getDate(), //日 
		"h+": this.getHours(), //小时 
		"m+": this.getMinutes(), //分 
		"s+": this.getSeconds(), //秒 
		"q+": Math.floor((this.getMonth() + 3) / 3), //季度 
		"S": this.getMilliseconds() //毫秒 
	};
	if(/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
	for(var k in o)
		if(new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
	return fmt;
}
	
setInterval(function () { 
    if (document.activeElement.className.indexOf('inputcontent') >= 0) {
        document.activeElement.scrollIntoViewIfNeeded();     }
}, 300);


//debugger
//mui.ajax({
//  type: 'HEAD', // 获取头信息，type=HEAD即可
//  url : window.location.href,
//  //url:"http://device.qq.com/cgi-bin/device_cgi/remote_bind_get_Verify",
//  complete: function( xhr,data ){
//      // 获取相关Http Response header
//      var wpoInfo = {
//          // 服务器端时间
//          "date" : xhr.getResponseHeader('Date'),
//          // 如果开启了gzip，会返回这个东西
//          "contentEncoding" : xhr.getResponseHeader('Content-Encoding'),
//          // keep-alive ？ close？
//          "connection" : xhr.getResponseHeader('Connection'),
//          "access_token": xhr.getResponseHeader('access_token'),
//          // 响应长度
//          "contentLength" : xhr.getResponseHeader('content-length'),
//          // 服务器类型，apache？lighttpd？
//          "server" : xhr.getResponseHeader('Server'),
//          "vary" : xhr.getResponseHeader('Vary'),
//          "transferEncoding" : xhr.getResponseHeader('Transfer-Encoding'),
//          // text/html ? text/xml?
//          "contentType" : xhr.getResponseHeader('Content-Type'),
//          "cacheControl" : xhr.getResponseHeader('Cache-Control'),
//          // 生命周期？
//          "exprires" : xhr.getResponseHeader('Exprires'),
//          "lastModified" : xhr.getResponseHeader('Last-Modified')
//      };
//      console.log(xhr.getAllResponseHeaders());
//  }
//})
//debugger